﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<fmt:setBundle basename="bundles.autobaseBundle" />

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        
        <title>Autobase :: Registration</title>
        <link href="layout/css/main.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="layout/jsc/jquery.min.js"></script>
        <script type="text/javascript" src="layout/jsc/jquery.validate.min.js"></script>
        <script type="text/javascript">
        	$(document).ready(function(){
        		$('#request_form').validate({
		        	rules: {
		        			name: "required",
		        			surname: "required",
		        			pass: {
		        			  	minlength: 5
		        			},
		        			pass_retry: {
		        				minlength: 5,
		        				equalTo: "#password"
		        				}, 
		        			email: {
		        				required: true,
		        				email: true
		        			}
		        	},
		        	messages: {
		        		name: "Please enter your name",
		        		surname: "Please enter your surname",
		        		password: {
		        			required: "Please enter your password",
		        			minlegth: "Password must be more than 5 symbols"
		        		},
		    	    	password: {
		    				required: "Please enter your password",
		    				minlegth: "Password must be more than 5 symbols",
		    				equalTo: "Passwords does not match"	
		    			},
		    			email: {
		    				required: "Please enter your valid email"
		    			}
		        	}
		        	
		        });
        	});  
        </script>
        
    </head>

    <body>
    
    	<table id="conteiner">
            <tr>
                <td id="content_center">
               		<c:set var="message" value="${ sessionScope['message']}"></c:set>
                    <c:if test="${ not empty message }">
                		<div class="mess sucess">
	                    	<c:out value="${ message}"></c:out>
	                    	<c:remove var="message" />
	                    </div>
                	</c:if>
                	<c:set var="error" value="${ sessionScope['error']}"></c:set>
                     <c:if test="${ not empty error }">
                		<div class="mess error_m">
	                    	 <c:out value="${ error}"></c:out>
	                    	 <c:remove var="error" />
	                    </div>
                	 </c:if>
                	  
                	<div id="request_task">
    					<h1><fmt:message key="index.registration" /> </h1>
                            <form method="post" action="register.do" id="request_form">
                            	
                                <h2><fmt:message key="registration.name" /></h2>
                                <input type="text" name="name" id="name"  />
                                <h2><fmt:message key="registration.surname" /></h2>
                                <input type="text" name="surname" id="surname" />
                                <h2><fmt:message key="registration.password" /></h2>
                                <input type="password" name="pass" class="inputbox required password" value="" id="password"  />
                                <h2><fmt:message key="registration.password.confirm" /></h2>
                                <input type="password" name="pass_retry" class="inputbox required password" value="" id="password_confirm" />
                                <h2><fmt:message key="registration.email" /></h2>
                                <input type="text" name="email" id="email"  />
                                <input type="image" align="right" src="layout/img/button_registration.png" value="click" name="request_button" />
                                <div class="clear"></div>
                            </form>
					</div>
                </td>
            </tr>
            <tr>
               <jsp:include page="/footer.jsp" />
            </tr>

        </table>
    </body>
</html>